#include <cstdio>

int main() {
	unsigned int hex;
	scanf("%x", &hex);
	printf("%u\n", hex);
	return 0;
}
